//
//  SHBlockTwoViewController.m
//  SDemo
//
//  Created by gg on 2018/7/24.
//  Copyright © 2018年 gg. All rights reserved.
//

#import "SHBlockTwoViewController.h"

@interface SHBlockTwoViewController ()

@end

@implementation SHBlockTwoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"block 2";
    self.view.backgroundColor = [UIColor cyanColor];
    
    UIButton *button = [UIButton buttonWithType:(UIButtonTypeCustom)];
    button.frame = CGRectMake(10, 100, 200, 45);
    [button setTitle:@"点击button" forState:(UIControlStateNormal)];
    [button setBackgroundColor:[UIColor yellowColor]];
    [button addTarget:self action:@selector(buttoClick) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:button];
    
}


-(void) buttoClick {
    if ([self.delegate respondsToSelector:@selector(getBackValue:)]) {
        [self.delegate getBackValue:@"这是一个测试"];
    }
    
    [self.navigationController popViewControllerAnimated:YES];
    
}


- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    //self.myblock(@"测试block传值");
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
